package com.linsir.ext.beetl.format;

import com.linsir.common.utils.web.HtmlUtil;
import org.beetl.core.Format;

/**
 * @author linsir
 * @title: XSSFormat
 * @projectName linsir-mu
 * @description: TODO
 * @date 2021/12/3 22:53
 */
public class XSSFormat implements Format {

        @Override
        public Object format(Object data, String pattern) {
                if (null == data) {
                        return null;
                } else {
                        String content = (String) data;
                        // XSS简单过滤
                        content = HtmlUtil.XSSEncode(content);
                        return content;
                }
        }
}
